package com.example.comactionbaar;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.example.widget.ComActionBar;

/**
 * 自定义actionBar
 *
 * @author MAC
 */
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ComActionBar actionBar = findViewById(R.id.actionBar01);
        actionBar.setLeftText("返回上一级");
        actionBar.setRightOnItemClickListener01(((viewId, textView, dividerLine) -> showToast("点击right01")));
        actionBar.setRightOnItemClickListener02(((viewId, textView, dividerLine) -> showToast("点击right02")));
    }

    private void showToast(String msg) {
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }
}